home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / glchess / ggz / protocol.pyc (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  33.0 KB  |  810 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import xml.sax.handler as xml
  5.  
  6. class ParserFeedback:
  7.     
  8.     def onResult(self, action, code):
  9.         pass
  10.  
  11.     
  12.     def onMOTD(self, motd):
  13.         pass
  14.  
  15.     
  16.     def onChat(self, chatType, sender, text):
  17.         pass
  18.  
  19.     
  20.     def onJoin(self, tableId, isSpectator):
  21.         pass
  22.  
  23.     
  24.     def onLeave(self, reason):
  25.         pass
  26.  
  27.     
  28.     def gameAdded(self, gameId, name, version, author, url, numPlayers, protocol_engine, protocol_version):
  29.         pass
  30.  
  31.     
  32.     def roomAdded(self, roomId, gameId, name, description, nPlayers):
  33.         pass
  34.  
  35.     
  36.     def roomPlayersUpdate(self, roomId, nPlayers):
  37.         pass
  38.  
  39.     
  40.     def tableAdded(self, roomId, tableId, gameId, status, nSeats, description):
  41.         pass
  42.  
  43.     
  44.     def tableStatusChanged(self, tableId, status):
  45.         pass
  46.  
  47.     
  48.     def seatChanged(self, roomId, tableId, seatId, seatType, user):
  49.         pass
  50.  
  51.     
  52.     def tableRemoved(self, tableId):
  53.         pass
  54.  
  55.     
  56.     def onPlayerList(self, room, players):
  57.         pass
  58.  
  59.     
  60.     def playerAdded(self, name, playerType, tableId, perms, lag, room, fromRoom):
  61.         pass
  62.  
  63.     
  64.     def playerRemoved(self, name, room, toRoom):
  65.         pass
  66.  
  67.  
  68.  
  69. class GGZParser:
  70.     '''
  71.     '''
  72.     parent = None
  73.     parser = None
  74.     
  75.     def startElement(self, name, attributes):
  76.         if self.parser is not None:
  77.             self.parser.startElement(name, attributes)
  78.             return None
  79.         
  80.         try:
  81.             method = getattr(self, 'start_%s' % name.lower())
  82.         except AttributeError:
  83.             self.parser is not None
  84.             self.parser is not None
  85.             print 'Unknown start element: %s' % name
  86.         except:
  87.             self.parser is not None
  88.  
  89.         method(attributes)
  90.  
  91.     
  92.     def characters(self, data):
  93.         if self.parser is not None:
  94.             self.parser.characters(data)
  95.             return None
  96.         self.handle_data(data)
  97.  
  98.     
  99.     def endElement(self, name):
  100.         if self.parser is not None:
  101.             self.parser.endElement(name)
  102.             return None
  103.         
  104.         try:
  105.             method = getattr(self, 'end_%s' % name.lower())
  106.         except AttributeError:
  107.             self.parser is not None
  108.             self.parser is not None
  109.             print 'Unknown end element: %s' % name
  110.         except:
  111.             self.parser is not None
  112.  
  113.         method()
  114.  
  115.     
  116.     def push(self, parser, attributes):
  117.         if not self.parser is None:
  118.             raise AssertionError
  119.         parser.attributes = attributes
  120.         parser.decoder = self.decoder
  121.         parser.parent = self
  122.         self.parser = parser
  123.  
  124.     
  125.     def pop(self):
  126.         if not self.parent is not None:
  127.             raise AssertionError
  128.         parser = self.parent.parser
  129.         self.parent.parser = None
  130.         self.parent.childFinished(parser)
  131.  
  132.     
  133.     def handle_data(self, data):
  134.         pass
  135.  
  136.     
  137.     def childFinished(self, parser):
  138.         pass
  139.  
  140.  
  141.  
  142. class GameParser(GGZParser):
  143.     """
  144.     <GAME ID='24' NAME='TicTacToe' VERSION='0.0.9'>
  145.     <PROTOCOL ENGINE='TicTacToe' VERSION='4'/>
  146.     <ALLOW PLAYERS='2' BOTS='1' SPECTATORS='true' PEERS='false'/>
  147.     <BOT NAME='Alfred' CLASS='easy'/>
  148.     <BOT NAME='Tarantula' CLASS='hard'/>
  149.     <ABOUT AUTHOR='Brent Hendricks' URL='http://www.ggzgamingzone.org/games/tictactoe/'/>
  150.     <DESC>Simple GGZ game module for playing Tic-Tac-Toe</DESC>
  151.     </GAME>
  152.     """
  153.     
  154.     def __init__(self):
  155.         self.bots = []
  156.  
  157.     
  158.     def start_desc(self, attributes):
  159.         self.push(DescriptionParser(), attributes)
  160.  
  161.     
  162.     def start_protocol(self, attributes):
  163.         self.push(GameProtocolParser(), attributes)
  164.  
  165.     
  166.     def start_allow(self, attributes):
  167.         self.push(GameAllowParser(), attributes)
  168.  
  169.     
  170.     def start_bot(self, attributes):
  171.         self.push(GameBotParser(), attributes)
  172.  
  173.     
  174.     def start_about(self, attributes):
  175.         self.push(GameAboutParser(), attributes)
  176.  
  177.     
  178.     def end_game(self):
  179.         self.gameId = self.attributes['ID']
  180.         self.name = self.attributes['NAME']
  181.         self.version = self.attributes['VERSION']
  182.         self.pop()
  183.  
  184.     
  185.     def __str__(self):
  186.         return 'GGZ Game id=%s protocol=%s (%s) description=%s' % (self.gameId, repr(self.protocol.engine), self.protocol.version, repr(self.description))
  187.  
  188.  
  189.  
  190. class DescriptionParser(GGZParser):
  191.     '''   
  192.     <DESC>Simple GGZ game module for playing Tic-Tac-Toe</DESC>
  193.     '''
  194.     
  195.     def handle_data(self, data):
  196.         self.parent.description = data
  197.  
  198.     
  199.     def end_desc(self):
  200.         self.pop()
  201.  
  202.  
  203.  
  204. class GameProtocolParser(GGZParser):
  205.     """
  206.     <PROTOCOL ENGINE='TicTacToe' VERSION='4'/>
  207.     """
  208.     
  209.     def end_protocol(self):
  210.         self.parent.protocol = self
  211.         self.engine = self.attributes['ENGINE']
  212.         self.version = self.attributes['VERSION']
  213.         self.pop()
  214.  
  215.  
  216.  
  217. class GameAllowParser(GGZParser):
  218.     """
  219.     <ALLOW PLAYERS='2' BOTS='1' SPECTATORS='true' PEERS='false'/>
  220.     """
  221.     
  222.     def end_allow(self):
  223.         self.parent.allow = self
  224.         self.numPlayers = self.attributes['PLAYERS']
  225.         self.pop()
  226.  
  227.  
  228.  
  229. class GameBotParser(GGZParser):
  230.     """
  231.     <BOT NAME='Alfred' CLASS='easy'/>
  232.     <BOT NAME='Tarantula' CLASS='hard'/>
  233.     """
  234.     
  235.     def end_bot(self):
  236.         self.parent.bots.append(self)
  237.         self.name = self.attributes['NAME']
  238.         self.difficulty = self.attributes['CLASS']
  239.         self.pop()
  240.  
  241.  
  242.  
  243. class GameAboutParser(GGZParser):
  244.     """
  245.     <ABOUT AUTHOR='Brent Hendricks' URL='http://www.ggzgamingzone.org/games/tictactoe/'/>
  246.     """
  247.     
  248.     def end_about(self):
  249.         self.parent.about = self
  250.         self.author = self.attributes['AUTHOR']
  251.         self.url = self.attributes['URL']
  252.         self.pop()
  253.  
  254.  
  255.  
  256. class RoomParser(GGZParser):
  257.     
  258.     def start_desc(self, attributes):
  259.         self.push(DescriptionParser(), attributes)
  260.  
  261.     
  262.     def end_room(self):
  263.         self.pop()
  264.  
  265.     
  266.     def __str__(self):
  267.         return 'GGZ Room id=%s game=%s description=%s' % (self.roomId, self.game, repr(self.description))
  268.  
  269.  
  270.  
  271. class PlayerParser(GGZParser):
  272.     
  273.     def end_player(self):
  274.         self.pop()
  275.  
  276.     
  277.     def __str__(self):
  278.         return 'GGZ Player id=%s type=%s table=%s perms=%s lag=%s' % (self.id, self.type, self.table, self.perms, self.lag)
  279.  
  280.  
  281.  
  282. class TableSeatParser(GGZParser):
  283.     
  284.     def __init__(self):
  285.         self.label = ''
  286.  
  287.     
  288.     def handle_data(self, data):
  289.         self.label += data
  290.  
  291.     
  292.     def end_seat(self):
  293.         self.pop()
  294.  
  295.  
  296.  
  297. class TableParser(GGZParser):
  298.     
  299.     def __init__(self):
  300.         self.seats = []
  301.         self.description = ''
  302.  
  303.     
  304.     def start_desc(self, attributes):
  305.         self.push(DescriptionParser(), attributes)
  306.  
  307.     
  308.     def start_seat(self, attributes):
  309.         self.push(TableSeatParser(), attributes)
  310.  
  311.     
  312.     def childFinished(self, parser):
  313.         if isinstance(parser, TableSeatParser):
  314.             self.seats.append(parser)
  315.         
  316.  
  317.     
  318.     def end_table(self):
  319.         self.pop()
  320.  
  321.  
  322.  
  323. class GameListParser(GGZParser):
  324.     
  325.     def __init__(self):
  326.         self.games = []
  327.  
  328.     
  329.     def start_game(self, attributes):
  330.         self.push(GameParser(), attributes)
  331.  
  332.     
  333.     def childFinished(self, parser):
  334.         self.games.append(parser)
  335.  
  336.     
  337.     def end_list(self):
  338.         for g in self.games:
  339.             self.decoder.feedback.gameAdded(g.gameId, g.name, g.version, g.about.author, g.about.url, g.allow.numPlayers, g.protocol.engine, g.protocol.version)
  340.         
  341.         self.pop()
  342.  
  343.  
  344.  
  345. class TableListParser(GGZParser):
  346.     
  347.     def __init__(self):
  348.         self.tables = []
  349.  
  350.     
  351.     def start_table(self, attributes):
  352.         self.push(TableParser(), attributes)
  353.  
  354.     
  355.     def childFinished(self, parser):
  356.         self.tables.append(parser)
  357.  
  358.     
  359.     def end_list(self):
  360.         for t in self.tables:
  361.             room = self.attributes['ROOM']
  362.             tableId = t.attributes['ID']
  363.             gameId = t.attributes['GAME']
  364.             status = t.attributes['STATUS']
  365.             nSeats = int(t.attributes['SEATS'])
  366.             self.decoder.feedback.tableAdded(room, tableId, gameId, status, nSeats, t.description)
  367.             for seat in t.seats:
  368.                 self.decoder.feedback.seatChanged(room, tableId, seat.attributes['NUM'], seat.attributes['TYPE'], seat.label)
  369.             
  370.         
  371.         self.pop()
  372.  
  373.  
  374.  
  375. class PlayerListParser(GGZParser):
  376.     
  377.     def __init__(self):
  378.         self.players = []
  379.  
  380.     
  381.     def start_player(self, attributes):
  382.         self.push(PlayerParser(), attributes)
  383.  
  384.     
  385.     def childFinished(self, playerParser):
  386.         playerParser.name = playerParser.attributes['ID']
  387.         playerParser.type = playerParser.attributes['TYPE']
  388.         playerParser.tableId = playerParser.attributes['TABLE']
  389.         
  390.         try:
  391.             playerParser.perms = playerParser.attributes['PERMS']
  392.         except KeyError:
  393.             playerParser.perms = ''
  394.  
  395.         playerParser.lag = playerParser.attributes['LAG']
  396.         self.players.append(playerParser)
  397.  
  398.     
  399.     def end_list(self):
  400.         self.decoder.feedback.onPlayerList(self.attributes['ROOM'], self.players)
  401.         self.pop()
  402.  
  403.  
  404.  
  405. class RoomListParser(GGZParser):
  406.     
  407.     def __init__(self):
  408.         self.rooms = []
  409.  
  410.     
  411.     def start_room(self, attributes):
  412.         self.push(RoomParser(), attributes)
  413.  
  414.     
  415.     def childFinished(self, parser):
  416.         parser.roomId = parser.attributes['ID']
  417.         parser.name = parser.attributes['NAME']
  418.         parser.game = parser.attributes['GAME']
  419.         parser.nPlayers = int(parser.attributes['PLAYERS'])
  420.         self.rooms.append(parser)
  421.  
  422.     
  423.     def end_list(self):
  424.         for r in self.rooms:
  425.             self.decoder.feedback.roomAdded(r.roomId, r.game, r.name, r.description, r.nPlayers)
  426.         
  427.         self.pop()
  428.  
  429.  
  430.  
  431. class ServerOptionsParser(GGZParser):
  432.     
  433.     def end_options(self):
  434.         self.pop()
  435.  
  436.  
  437.  
  438. class ServerParser(GGZParser):
  439.     
  440.     def start_options(self, attributes):
  441.         self.push(ServerOptionsParser(), attributes)
  442.  
  443.     
  444.     def end_server(self):
  445.         self.decoder.feedback.onConnected()
  446.         self.pop()
  447.  
  448.  
  449.  
  450. class MOTDParser(GGZParser):
  451.     
  452.     def __init__(self):
  453.         self.motd = ''
  454.  
  455.     
  456.     def handle_data(self, data):
  457.         self.motd += data
  458.  
  459.     
  460.     def end_motd(self):
  461.         self.decoder.feedback.onMOTD(self.motd)
  462.         self.pop()
  463.  
  464.  
  465.  
  466. class RoomUpdateParser(GGZParser):
  467.     
  468.     def __init__(self):
  469.         pass
  470.  
  471.     
  472.     def start_room(self, attributes):
  473.         self.push(RoomParser(), attributes)
  474.  
  475.     
  476.     def childFinished(self, parser):
  477.         action = self.attributes['ACTION'].lower()
  478.         if action == 'players':
  479.             roomId = parser.attributes['ID']
  480.             nPlayers = int(parser.attributes['PLAYERS'])
  481.             self.decoder.feedback.roomPlayersUpdate(roomId, nPlayers)
  482.         else:
  483.             print 'Unknown player update action %s' % action
  484.  
  485.     
  486.     def end_update(self):
  487.         self.pop()
  488.  
  489.  
  490.  
  491. class PlayerUpdateParser(GGZParser):
  492.     
  493.     def start_player(self, attributes):
  494.         self.push(PlayerParser(), attributes)
  495.  
  496.     
  497.     def childFinished(self, parser):
  498.         action = self.attributes['ACTION'].lower()
  499.         if action == 'add':
  500.             name = parser.attributes['ID']
  501.             playerType = parser.attributes['TYPE']
  502.             table = parser.attributes['TABLE']
  503.             
  504.             try:
  505.                 perms = parser.attributes['PERMS']
  506.             except KeyError:
  507.                 perms = ''
  508.  
  509.             lag = parser.attributes['LAG']
  510.             roomId = self.attributes['ROOM']
  511.             fromRoomId = self.attributes['FROMROOM']
  512.             self.decoder.feedback.playerAdded(name, playerType, table, perms, lag, roomId, fromRoomId)
  513.         elif action == 'lag':
  514.             playerId = parser.attributes['ID']
  515.             lag = parser.attributes['LAG']
  516.             print 'Player %s lag changed to %s' % (playerId, lag)
  517.         elif action == 'join':
  518.             pass
  519.         elif action == 'leave':
  520.             pass
  521.         elif action == 'desc':
  522.             pass
  523.         elif action == 'seat':
  524.             pass
  525.         elif action == 'delete':
  526.             playerId = parser.attributes['ID']
  527.             room = self.attributes['ROOM']
  528.             toRoom = self.attributes['TOROOM']
  529.             self.decoder.feedback.playerRemoved(playerId, room, toRoom)
  530.         else:
  531.             print 'Unknown player update action %s' % action
  532.  
  533.     
  534.     def end_update(self):
  535.         self.pop()
  536.  
  537.  
  538.  
  539. class TableUpdateParser(GGZParser):
  540.     
  541.     def __init__(self):
  542.         self.table = None
  543.  
  544.     
  545.     def start_table(self, attributes):
  546.         self.push(TableParser(), attributes)
  547.  
  548.     
  549.     def childFinished(self, parser):
  550.         self.table = parser
  551.  
  552.     
  553.     def end_update(self):
  554.         room = self.attributes['ROOM']
  555.         action = self.attributes['ACTION']
  556.         if action == 'add':
  557.             room = self.attributes['ROOM']
  558.             tableId = self.table.attributes['ID']
  559.             gameId = self.table.attributes['GAME']
  560.             status = self.table.attributes['STATUS']
  561.             nSeats = int(self.table.attributes['SEATS'])
  562.             description = self.table.description
  563.             self.decoder.feedback.tableAdded(room, tableId, gameId, status, nSeats, description)
  564.             for seat in self.table.seats:
  565.                 self.decoder.feedback.seatChanged(room, tableId, seat.attributes['NUM'], seat.attributes['TYPE'], seat.label)
  566.             
  567.         elif action == 'join':
  568.             room = self.attributes['ROOM']
  569.             tableId = self.table.attributes['ID']
  570.             for seat in self.table.seats:
  571.                 self.decoder.feedback.seatChanged(room, tableId, seat.attributes['NUM'], seat.attributes['TYPE'], seat.label)
  572.             
  573.         elif action == 'leave':
  574.             room = self.attributes['ROOM']
  575.             tableId = self.table.attributes['ID']
  576.             for seat in self.table.seats:
  577.                 self.decoder.feedback.seatChanged(room, tableId, seat.attributes['NUM'], seat.attributes['TYPE'], '')
  578.             
  579.         elif action == 'status':
  580.             self.decoder.feedback.tableStatusChanged(self.table.attributes['ID'], self.table.attributes['STATUS'])
  581.         elif action == 'delete':
  582.             self.decoder.feedback.tableRemoved(self.table.attributes['ID'])
  583.         else:
  584.             print 'Unknown table update action: %s' % action
  585.         self.pop()
  586.  
  587.  
  588.  
  589. class ChatParser(GGZParser):
  590.     
  591.     def __init__(self):
  592.         self.text = ''
  593.  
  594.     
  595.     def handle_data(self, data):
  596.         self.text += data
  597.  
  598.     
  599.     def end_chat(self):
  600.         chatType = self.attributes['TYPE']
  601.         sender = self.attributes['FROM']
  602.         self.decoder.feedback.onChat(chatType, sender, self.text)
  603.         self.pop()
  604.  
  605.  
  606.  
  607. class ResultParser(GGZParser):
  608.     
  609.     def start_list(self, attributes):
  610.         t = attributes['TYPE'].lower()
  611.         if t == 'player':
  612.             self.push(PlayerListParser(), attributes)
  613.         elif t == 'room':
  614.             self.push(RoomListParser(), attributes)
  615.         elif t == 'game':
  616.             self.push(GameListParser(), attributes)
  617.         elif t == 'table':
  618.             self.push(TableListParser(), attributes)
  619.         else:
  620.             print 'Unknown list: %s' % t
  621.  
  622.     
  623.     def end_result(self):
  624.         action = self.attributes['ACTION']
  625.         code = self.attributes['CODE']
  626.         self.decoder.feedback.onResult(action, code)
  627.         self.pop()
  628.  
  629.  
  630.  
  631. class JoinParser(GGZParser):
  632.     
  633.     def end_join(self):
  634.         tableId = self.attributes['TABLE']
  635.         isSpectator = self.attributes['SPECTATOR'] == 'true'
  636.         self.decoder.feedback.onJoin(tableId, isSpectator)
  637.         self.pop()
  638.  
  639.  
  640.  
  641. class LeaveParser(GGZParser):
  642.     """<LEAVE REASON='gameover'/>"""
  643.     
  644.     def end_leave(self):
  645.         reason = self.attributes['REASON']
  646.         self.decoder.feedback.onLeave(reason)
  647.         self.pop()
  648.  
  649.  
  650.  
  651. class SessionParser(GGZParser):
  652.     
  653.     def start_server(self, attributes):
  654.         self.push(ServerParser(), attributes)
  655.  
  656.     
  657.     def start_motd(self, attributes):
  658.         self.push(MOTDParser(), attributes)
  659.  
  660.     
  661.     def start_update(self, attributes):
  662.         t = attributes['TYPE'].lower()
  663.         if t == 'room':
  664.             self.push(RoomUpdateParser(), attributes)
  665.         elif t == 'player':
  666.             self.push(PlayerUpdateParser(), attributes)
  667.         elif t == 'table':
  668.             self.push(TableUpdateParser(), attributes)
  669.         else:
  670.             print 'Unknown update type: %s' % t
  671.  
  672.     
  673.     def start_join(self, attributes):
  674.         self.push(JoinParser(), attributes)
  675.  
  676.     
  677.     def start_leave(self, attributes):
  678.         self.push(LeaveParser(), attributes)
  679.  
  680.     
  681.     def start_result(self, attributes):
  682.         self.push(ResultParser(), attributes)
  683.  
  684.     
  685.     def start_chat(self, attributes):
  686.         self.push(ChatParser(), attributes)
  687.  
  688.     
  689.     def start_ping(self, attributes):
  690.         self.decoder.feedback.send('<PONG/>\n')
  691.  
  692.     
  693.     def end_ping(self):
  694.         pass
  695.  
  696.     
  697.     def end_session(self):
  698.         self.decoder.feedback.onSessionEnded()
  699.  
  700.  
  701.  
  702. class BaseParser(GGZParser):
  703.     
  704.     def __init__(self, decoder):
  705.         self.decoder = decoder
  706.  
  707.     
  708.     def start_session(self, attributes):
  709.         self.push(SessionParser(), attributes)
  710.  
  711.  
  712.  
  713. class Decoder(xml.sax.handler.ContentHandler):
  714.     
  715.     def __init__(self, feedback):
  716.         xml.sax.handler.ContentHandler.__init__(self)
  717.         self.feedback = feedback
  718.         self.parser = None
  719.         self.xparser = xml.sax.make_parser()
  720.         self.handler = BaseParser(self)
  721.         self.xparser.setContentHandler(self)
  722.  
  723.     
  724.     def startElement(self, name, attributes):
  725.         self.handler.startElement(name, attributes)
  726.  
  727.     
  728.     def characters(self, data):
  729.         self.handler.characters(data)
  730.  
  731.     
  732.     def endElement(self, name):
  733.         self.handler.endElement(name)
  734.  
  735.     
  736.     def feed(self, data):
  737.         """Feed data into the decoder.
  738.         
  739.         'data' is the raw data to feed.
  740.         
  741.         Returns the next block of data to process, keep feeding until '' is returned.
  742.         """
  743.         index = data.find('\n')
  744.         if index < 0:
  745.             index = len(data) - 1
  746.         
  747.         chunk = data[:index + 1]
  748.         
  749.         try:
  750.             self.xparser.feed(chunk)
  751.         except xml.sax.SAXParseException:
  752.             print 'Invalid XML: %s' % repr(chunk)
  753.  
  754.         return data[index + 1:]
  755.  
  756.  
  757. if __name__ == '__main__':
  758.     import chess
  759.     
  760.     class F:
  761.         
  762.         def onSeat(self, seatNum, version):
  763.             print ('onSeat', seatNum, version)
  764.  
  765.         
  766.         def onPlayers(self, whiteType, whiteName, blackType, blackName):
  767.             print ('onPlayers', whiteType, whiteName, blackType, blackName)
  768.  
  769.         
  770.         def onTimeRequest(self):
  771.             print ('onTimeRequest',)
  772.  
  773.         
  774.         def onSetTime(self, time):
  775.             print ('onSetTime', time)
  776.  
  777.         
  778.         def onStart(self):
  779.             print ('onStart',)
  780.  
  781.         
  782.         def onMove(self, move):
  783.             print ('onMove', move)
  784.  
  785.  
  786.     f = F()
  787.     d = chess.Chess(f)
  788.     data = '\x01\x01\x06'
  789.     for c in data:
  790.         d.decode(c)
  791.     
  792.     data = '\x02\x03\x00\x00\x00\x0eglchess-test2\x00\x03\x00\x00\x00\rglchess-test\x00'
  793.     for c in data:
  794.         d.decode(c)
  795.     
  796.     data = '\x04\x00\x00\x00\x00'
  797.     for c in data:
  798.         d.decode(c)
  799.     
  800.     d.decode('\x05')
  801.     data = '\x07\x00\x00\x00\x05F2F4\x00'
  802.     for c in data:
  803.         d.decode(c)
  804.     
  805.     data = '\n\x00\x00\x00\x00\x00\x00\x00\x00'
  806.     for c in data:
  807.         d.decode(c)
  808.     
  809.  
  810.